<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/purchase.js" ></script>
<title>质检处理</title>
<style>
.p_del{height:14px; width:14px;background:url(/fuman/images/no.gif) no-repeat;text-decoration:none;}
.p_img{width:100px;}
#search_rs{width:800px;position:absolute;background:#fff;border:1px solid gray;}
#search_rs .thead td{background:gray;color:#fff;}
#search_rs td{background:#f1f1f1;}
#search_rs img{height:30px;}
.price{width:60px;height:22px;border:1px solid #A6A6A6;line-height:22px;padding:0 0 0 2px;font-size:14px;line-height:20px;}
.num{width:60px;height:22px;border:1px solid #A6A6A6;line-height:22px;padding:0 0 0 2px;font-size:14px;line-height:20px;}
.total{width:60px;height:22px;border:1px solid #A6A6A6;line-height:22px;padding:0 0 0 2px;font-size:14px;line-height:20px;}
</style>
<script language="javascript">
    function showRemark(id) {
        $("#vice_id").val(id); //purchase_vice  id
        $("#remarks").val("");
        //$("#insttime").val("");
        $("#goods_num").val("");
        $('#showmabangorder').modal('show');
    }
    function atmangban()
    {
        var insttime = $("#insttime").val();
        if(insttime=="")
        {
            alert("请输入日期！");
            return;
        }
        var goods_num = $("#goods_num").val();
        if(goods_num=="")
        {
            alert("请输入数量！");
            return;
        }
        var remarks = $("#remarks").val();
        /**
        if(remarks==""){
            alert("请输入备注");
            return ;
        }**/
        var vice_id = $("#vice_id").val();
        remarks = remarks+"("+insttime+","+goods_num+")";
        $.post("/purchase/ajaxbutton", {"op": "updMemoData","insttime":insttime,"goods_num":goods_num,"remarks":remarks,"vice_id":vice_id},
                function(data){
                    if(data==200)
                    {
                        window.location.reload();
                    }else{
                        alert("操作失败");return false;
                    }
                },"text");
    }
    function delMemo(id,memo) {
        if(!id){
            alert("无效参数");return false;
        }
        var memo = $.trim(memo);
        var msg = "你确定删除"+"【"+memo+"】"+"这条备注吗?";
        var message = confirm(msg);
        if(message){
            $.post("/purchase/ajaxbutton", {"op": "delMemo","memo":memo,"id":id},
                    function(data){
                        if(data==200)
                        {
                            alert("删除成功!");
                            window.location.reload();
                        }else{
                            alert("错误");
                            location.reload();
                        }
                    },"text");
        }
    }
    function changeStorage(id) {
        var storageid = $("#storagecang").val();
        if(!storageid){
            alert("请选择需要保存的仓库");return false;
        }
        if(confirm("你确认修改保存仓库吗？")){
            $.post("/purchase/ajaxbutton", {"op": "changeStorage","id":id,"storageid":storageid},
                    function(data){
                        if(data==200)
                        {
                            window.location.reload();
                        }else{
                            alert("错误");
                            location.reload();
                        }
                    },"text");
        }
    }
</script>
<body class="withvernav">
<div class="bodywrapper">
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">质检处理</h1>
      <span class="pagedesc"></span>
      <div class="menulist">
        <ul class="profile_summary">
         
        </ul>
      </div>
    </div>
    <!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper">
      <div id="basicform" class="subcontent">
        <form class="stdform stdform2"  id="goodsForm" method="post" action="#">
        <input type="hidden" name="pid" value="{{$detail.id}}">
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
            <thead>
              <tr>
                <th colspan="8" class="head1">采购单信息</th>
              </tr>
            </thead>
            <tr>
             <td width="12%" align="right">采购编号：</td>
              <td width="12%">{{$detail.orderstockid}}</td>
              <td width="12%" align="right">采购人：</td>
              <td width="12%">{{$detail.createuser}}</td>
              <td width="8%" height="40" align="right">入库仓：</td>
              <td width="7%">
                  <select name="storagecang" id="storagecang" class="selection" style="width:100px;" onChange="changeStorage({{$detail.id}})">
                      <option value="" >请选择</option>
                      <option value="1" {{if $detail.cang==1}} selected{{/if}}>一号仓</option>
                      <option value="2" {{if $detail.cang==2}} selected{{/if}}>二号仓</option>
                  </select>
                  <!--
                  {{$detail.storagename}}
                  -->

              </td>
              <td width="7%" align="right">采购时间：</td>
              <td width="12%">{{$detail.opertime}}</td>
             
            </tr>
         
          
            {{if $detail.memo}}
            <tr>
            <td align="right">备注：</td>
              <td height="40" colspan="8">
{{$detail.memo}}        </td>
            </tr>
            {{/if}}
          </table>
        {{if $detail.types1==1}}
         
          
              
                
 <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
{{foreach from=$detail.tborder item=kdee key=key}}
  <tr>
    <td>单号：{{$kdee}}</td>
    <td>{{$detail.kdname.$key}}：{{$detail.kdnumber.$key}}</td>
  </tr>
{{/foreach}}
  
</table>

             
              {{else}}
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="stdtable">
  <tr>
    <td>单号：{{$detail.tborder}}</td>
    <td>快递公司：{{$detail.kdname}}</td>
    <td>运单号：{{$detail.tb_kd}}</td>
  </tr>
</table>
              {{/if}}
       
           <br> <br>
           
          <div class="px1" style="background: #FFFFCC;border: 1px solid #CCCCCC;height: 24px; width:100px;padding: 10px 5px 0px 5px; margin-bottom:10px;">
                <img src="/fuman/images/barcode.png">
                <a href="#" onClick="printbar({{$detail.cang}})">打印条形码</a>
          </div>
            {{if $end_flag eq 1}}
            <div style="margin-left:500px;">
                <span style="color:red;font-size:24px;">工厂结束该批次的生产。本次生产数量作为最后数量</span>
            </div>
            {{/if}}

         
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable" style="table-layout: fixed;" id="purchase_list">
          <thead>
  

            <tr>
            <td height="35" width="5%"  bgcolor="#FEFFF1"><input onClick="allSelect('idarr[]')" type="checkbox"></td>
              <td height="35" width="8%"  bgcolor="#FEFFF1"><b>商品图片</b></td>
              <td  bgcolor="#FEFFF1" width="15%"><b>商品名称</b></td>
              <td width="10%" bgcolor="#FEFFF1"><b>商品编号</b></td>
              <td width="7%" bgcolor="#FEFFF1"><strong>标识、备注</strong></td>
              <td width="3%" bgcolor="#FEFFF1"><b>数量</b></td>
              <td width="3%" bgcolor="#FEFFF1">质检数</td>
                <td width="8%" bgcolor="#FEFFF1">入库数量</td>
              <td width="8%" bgcolor="#FEFFF1"><strong>当前库存</strong></td>
            </tr>
            </thead>
             {{foreach from=$detail_list item=li key=key}}
            <tr>
              <td width="3%" bgcolor="#FFFFFF">
                <input name="idarr[]" type="checkbox" class="none" id="ppid[]" value="{{$li.id}}" />
             
              
              </td>
              <td width="20%" bgcolor="#FFFFFF"><div class="lbt"><a href="{{$li.imagesurl}}" target="_blank"><img src={{$li.imagesurl}} width="60" height="60"></a></div>
                  </td>
              <td bgcolor="#FFFFFF">{{$li.good_name}}</td>
              <td bgcolor="#FFFFFF">
                  <a href="javascript:void(0)" onClick="window.open('/product/productlist?other={{$li.good_no}}')">{{$li.good_no}}</a>
              </td>
              <td bgcolor="#FFFFFF">
               {{if $li.skucode}}
            	识别码：{{$li.skucode}}<br>
               {{/if}}
                {{if $li.skumemo}}
                	备注：{{$li.skumemo}}
              	{{/if}}
              
              </td>
              <td bgcolor="#FFFFFF">{{$li.nums}}</td>
              <td bgcolor="#FFFFFF">
               <input name="viceid[]" type="hidden" class="none" id="viceid[]" value="{{$li.id}}" />
              <input type="text" size="3"  name="qualityinNum[]" value="{{$li.qualityinNum}}" /></td>
                <td bgcolor="#FFFFFF">
                    {{foreach from=$li.log item=rs key=key}}
                    <a href="javascript:void(0)" onClick="delMemo({{$rs.id}},this.text)" style="color:blue;" title="点击可删除该备注">
                        {{$rs.memo}}
                    </a>
                        <br/>
                    {{/foreach}}
                    
                    
                   <!-- <input type="button" name="upd_memo[]" id="upd_memo_{{$li.id}}" value="" placeholder="请输入备注内容" onClick="showRemark({{$li.id}})">-->
                    
                     <button type="button" onClick="showRemark({{$li.id}})" class="btn btn-primary" > 点击质检入库 </button>
                </td>
              <td bgcolor="#FFFFFF">
              {{foreach from=$li.storage item=lis key=key}}
              	{{$lis.stock}} {{$lis.storage_name}}  {{$lis.positions}} 				&nbsp;待发货 {{$lis.sendgoodsnum}}
                <br>
              {{/foreach}}
             </td>
            </tr>
           {{/foreach}}
          </table>
          
          <br>
          
            <tr>
                <td bgcolor="#FFFFFF" colspan="8">   <button type="button" onClick="saverightadd({{$detail.id}})" class="btn btn-primary" > 全部质检完成 </button>
                
               
              </td>
          </tr>
          </table>
       
        </form>
          <!-- 日志信息-->
          {{if $loglist}}
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
              <thead>
              <tr>
                  <th colspan="2" class="head1">日志信息</th>
              </tr>
              </thead>
          </table>
          <input type="hidden" id="hidden_data" value="" />

          <table cellpadding="0" cellspacing="0" border="0" class="stdtable" style="table-layout: fixed;" id="purchase_list">
              <thead>
              <tr>
                  <td bgcolor="#FEFFF1"><b>序号</b></td>
                  <td  bgcolor="#FEFFF1"><strong>商品名称</strong></td>
                  <td bgcolor="#FEFFF1"><strong>商品编号</strong></td>
                  <td bgcolor="#FEFFF1"><strong>商品子SKU</strong></td>
                  <td bgcolor="#FEFFF1"><strong>入库数量</strong></td>
                  <td bgcolor="#FEFFF1"><strong>备注</strong></td>
                  <td bgcolor="#FEFFF1"><strong>质检者</strong></td>
                  <td bgcolor="#FEFFF1"><strong>质检时间</strong></td>
                  <td bgcolor="#FEFFF1"><strong>所在仓位</strong></td>
              </tr>
              </thead>
              {{foreach from=$loglist item=li key=key}}
              <tr>
                  <td width="32%" bgcolor="#FFFFFF">{{$li.id}}</td>
                  <td bgcolor="#FFFFFF">{{$li.good_name}}</td>
                  <td bgcolor="#FFFFFF">{{$li.good_parent_sku}}</td>
                  <td bgcolor="#FFFFFF">{{$li.good_no}}</td>
                  <td bgcolor="#FFFFFF">{{$li.inStockNum}}</td>
                  <td bgcolor="#FFFFFF">{{$li.memo}}</td>
                  <td bgcolor="#FFFFFF">{{$li.username}}</td>
                  <td bgcolor="#FFFFFF">{{$li.createtime}}</td>
                  <td bgcolor="#FFFFFF">
                      {{if $li.cang eq 1}}
                      一号仓
                      {{elseif $li.cang eq 2}}
                      二号仓
                      {{else}}
                      {{/if}}
                  </td>
              </tr>
              {{/foreach}}
          </table>
          {{/if}}
       
      
    </div>
    <!--contentwrapper--> 
    
  </div>
  <!-- centercontent --> 
  
</div>
<!--bodywrapper-->
    <!-- 模态框（Modal）添加支出 -->
    <form  method="post">
        <input type="hidden" name="editid" id="editid">
        <div class="modal fade" id="showmabangorder" tabindex="-1" role="dialog" aria-labelledby="sshowmabangorder" aria-hidden="true">
            <div class="modal-dialog" style="width:740px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">× </button>
                        <h4 class="modal-title" id="sshowmabangorder"> 添加备注 </h4>
                    </div>
                    <div class="modal-body">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td align="right">当前日期：</td>
                                <td align="left"><input type="text" name="insttime" id="insttime" style="width:100px;line-height:0.4;"  onClick="WdatePicker()" value="{{$valuedate}}" >
                                    <font color="#FF0000">(*必填项)</font></td>
                            </tr>
                            <tr>
                                <td align="right">本次入库数量： </td>
                                <td align="left">
                                    <input type="hidden" name="vice_id" id="vice_id" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" />
                                    <input type="text" name="goods_num" id="goods_num" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" /> <font color="#FF0000">(*必填项)</font>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">备注： </td>
                                <td align="left"><input type="text" name="remarks" id="remarks" value="" maxlength="400" style="width:200px;line-height:0.4;" class="small_input" /> <font color="#FF0000"></font></td>
                            </tr>
                            <tr>
                        </table>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal"> 关闭 </button>
                            <button type="button" class="btn btn-primary"  onclick="atmangban()"> 提交 </button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
        </div>
        <!-- /.modal -->
    </form>
</body>
</html>